using System.IO;

namespace LuckyCoding.Models;

public class CodeFileModel : IFileModel
{
    public string? FileName { get; set; }
    public string? Location { get; set; }
    public string? Extension { get; set; }

    public CodeFileModel(string? location)
    {
        if (!File.Exists(location)) return;
        Location = location;
        FileName = Path.GetFileName(location);
        Extension = Path.GetExtension(location);
    }

    public override string ToString()
    {
        return FileName!;
    }
}